# -*- mode: python ; coding: utf-8 -*-
import os
import rasterio

block_cipher = None

# 获取rasterio库的路径
rasterio_path = os.path.dirname(rasterio.__file__)

# 主程序分析
a = Analysis(
    ['main_window.py'],
    pathex=[],
    binaries=[],
    datas=[
        ('fonts', 'fonts'), 
        ('pic', 'pic'),
        (rasterio_path, 'rasterio')
    ],
    hiddenimports=[
        'rasterio',
        'rasterio.sample',
        'rasterio._base',
        'rasterio._io',
        'rasterio._features',
        'rasterio._env',
        'rasterio._warp',
        'rasterio.control',
        'rasterio.coords',
        'rasterio.crs',
        'rasterio.drivers',
        'rasterio.enums',
        'rasterio.errors',
        'rasterio.features',
        'rasterio.fill',
        'rasterio.io',
        'rasterio.mask',
        'rasterio.merge',
        'rasterio.plot',
        'rasterio.profiles',
        'rasterio.sample',
        'rasterio.session',
        'rasterio.tools',
        'rasterio.transform',
        'rasterio.vrt',
        'rasterio.warp',
        'rasterio.windows'
    ],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

# 古建筑描述模块分析
building_a = Analysis(
    ['building_description.py'],
    pathex=[],
    binaries=[],
    datas=[('pic', 'pic')],  # 包含图片文件夹
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

# 碑刻描述模块分析
stele_a = Analysis(
    ['stele_description.py'],
    pathex=[],
    binaries=[],
    datas=[],
    hiddenimports=[],
    hookspath=[],
    hooksconfig={},
    runtime_hooks=[],
    excludes=[],
    win_no_prefer_redirects=False,
    win_private_assemblies=False,
    cipher=block_cipher,
    noarchive=False,
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
building_pyz = PYZ(building_a.pure, building_a.zipped_data, cipher=block_cipher)
stele_pyz = PYZ(stele_a.pure, stele_a.zipped_data, cipher=block_cipher)

# 主程序
exe = EXE(
    pyz,
    a.scripts,
    [],
    exclude_binaries=True,
    name='文物普查内业工具包',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
    icon='logo.png'
)

# 古建筑描述模块
building_exe = EXE(
    building_pyz,
    building_a.scripts,
    [],
    exclude_binaries=True,
    name='building_description',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

# 碑刻描述模块
stele_exe = EXE(
    stele_pyz,
    stele_a.scripts,
    [],
    exclude_binaries=True,
    name='stele_description',
    debug=False,
    bootloader_ignore_signals=False,
    strip=False,
    upx=True,
    console=False,
    disable_windowed_traceback=False,
    argv_emulation=False,
    target_arch=None,
    codesign_identity=None,
    entitlements_file=None,
)

# 收集所有文件
coll = COLLECT(
    exe,
    building_exe,
    stele_exe,
    a.binaries,
    building_a.binaries,
    stele_a.binaries,
    a.zipfiles,
    building_a.zipfiles,
    stele_a.zipfiles,
    a.datas,
    building_a.datas,
    stele_a.datas,
    strip=False,
    upx=True,
    upx_exclude=[],
    name='文物普查内业工具包',
) 